// Copyright 2011 Semantic Expression, Inc. All rights reserved.
//
// This program and the accompanying materials are made available under the
// terms of the GNU General Public License, either version 3 or (at your option)
// any later version. The terms of this license may be found at
// http://www.gnu.org/copyleft/gpl.html
//
// This program is made available on an "as is" basis, without warranties or
// conditions of any kind, either express or implied.
//
// Please contact us for other licensing options.
//
// Contributors:
//
// Anthony F. Stuart - Initial implementation
//
//
//

package com.semanticexpression.connector.client.frame.search;

import com.semanticexpression.connector.client.frame.editor.EditorStore;
import com.semanticexpression.connector.client.icons.Resources;
import com.semanticexpression.connector.shared.TagFilter;

public final class AddTagFilterWindow extends TagWindow
{
  private SearchFrame searchFrame;

  public AddTagFilterWindow(EditorStore editorStore)
  {
    super(Resources.TAG, "Add Tag Filter", "Enter Tag Name:", "Type characters to find matching tags", "or select existing tag that matches:", "Tag is Private (cannot be seen by others):", editorStore);
  }

  @Override
  public void okay()
  {
    String tagName = getNameTextField().getValue();
    boolean isPrivate = getYesRadio().getValue();
    searchFrame.addTagFilter(new TagFilter(tagName, isPrivate));
    hide();
   }

  public void bind(SearchFrame searchFrame)
  {
    this.searchFrame = searchFrame;
    reset();
  }

}
